package com.usts.edu.studenttemp.service;

import com.usts.edu.studenttemp.dto.*;
import com.usts.edu.studenttemp.mapper.TemperatureMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * Created by Guanzhong Hu
 * Date :2020/5/31
 * Description :
 * Version :1.0
 */
@Service
public class TemperatureServiceImpl implements TemperatureService {


    @Resource
    private TemperatureMapper temperatureMapper;


    @Override
    public int insertSelectiveTemperature(String temp,Integer stuid) {

        Temperature temperature = new Temperature();
        temperature.setCreatetime(new Date());
        temperature.setStudentId(stuid);
        temperature.setTemp(temp);

        return temperatureMapper.insertSelective(temperature);
    }

    @Override
    public List<StudentTemperature> selectTemperatureByUserId(ResqStudentTemperature stemperature) {
        return temperatureMapper.selectTemperatureByUserId(stemperature);
    }

    @Override
    public ResqGetStudentTemperature selectStudentTempByStuid(Integer stuid) {
        return temperatureMapper.selectStudentTempByStuid(stuid);
    }

    @Override
    public int updateByPrimaryKeySelective(Temperature record) {
        return temperatureMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public List<AdminStudentTemperatureShow> selectAllStudentTemp(AdminStudentTemperature studentTemperature) {
        return temperatureMapper.selectAllStudentTemp(studentTemperature);
    }
}
